package com.qf.server;

import org.csource.common.MyException;
import org.csource.fastdfs.*;

import java.io.IOException;

/**
 * //                       .::::.
 * //                     .::::::::.
 * //                    :::::::::::  come on
 * //                 ..:::::::::::'
 * //              '::::::::::::'
 * //                .::::::::::
 * //           '::::::::::::::..
 * //                ..::::::::::::.
 * //              ``::::::::::::::::
 * //               ::::``:::::::::'        .:::.
 * //              ::::'   ':::::'       .::::::::.
 * //            .::::'      ::::     .:::::::'::::.
 * //           .:::'       :::::  .:::::::::' ':::::.
 * //          .::'        :::::.:::::::::'      ':::::.
 * //         .::'         ::::::::::::::'         ``::::.
 * //     ...:::           ::::::::::::'              ``::.
 * //    ```` ':.          ':::::::::'                  ::::..
 * //                       '.:::::'                    ':'````..
 * //
 *
 * @author:小川
 * @date: 2018/11/21 16:52
 */
public class UpLoadFile {
   public static void upload() throws IOException, MyException {
       //加载配置文件
       ClientGlobal.init("client.conf");
       //创建监听器客户端
       TrackerClient trackerClient=new TrackerClient();
       //得到监听器服务端
       TrackerServer trackerServer = trackerClient.getConnection();

       StorageServer storageServer=null;

       //创建存储器客户端
       StorageClient storageClient=new StorageClient(trackerServer,storageServer);

       //上传文件
       String[] jpgs =
               storageClient.upload_file("C:/Users/windows8.1/Pictures/85741f22c234e9606c4d8962a04c1f2a.jpg", "jpg", null);
       for (String jpg : jpgs) {
           System.out.println(jpg);
       }
   }

    public static void main(String[] args) throws IOException, MyException {
        System.out.println("xiaochuan");
        upload();
    }
}
